/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved.
 * Description: hccl实现基类头文件
 * Author: gaozhenyue
 * Create: 2024-04-03
 */

#ifndef HCCL_IMPL_CPU_WORK_H
#define HCCL_IMPL_CPU_WORK_H

#include "hccl_impl_base.h"

namespace hccl {

class HcclImplCpu : public HcclImplBase {
public:
    explicit HcclImplCpu();
    ~HcclImplCpu() override;

    HcclResult Send(const std::string &tag, void *inputPtr, u64 count, HcclDataType dataType,
        u32 destRank, rtStream_t stream);

    HcclResult Receive(const std::string &tag, void *outputPtr, u64 count, HcclDataType dataType,
        u32 srcRank, rtStream_t stream);

    HcclResult GatherByOs(void* inputBuf, uint64_t inputCount, HcclDataType inputType, void* outputBuf,
        uint64_t outputCount, HcclDataType outputType, int root, uint64_t flag, const std::string &tag);

    HcclResult BcastByOS(void* buf, uint64_t count, HcclDataType dataType,
        int root, uint64_t flag, const std::string &tag);

    HcclResult PrepareStart(const std::string &tag, void *inputPtr, u64 count,
        HcclDataType dataType, u32 peerRank);
    HcclResult PrepareStartColl(const std::string &tag, const HcomCollOpInfo &opInfo, HcomOperationType opType);
    HcclResult PrepareQuerry(const std::string &tag, u32& status);
    HcclResult PrepareCancel(const std::string &tag, u32& status);
    HcclResult PrepareGather(const std::string &tag, const HcomCollOpInfo &opInfo, HcomOperationType opType);
    HcclResult PrepareBroadcast(const std::string &tag, const HcomCollOpInfo &opInfo, HcomOperationType opType);
    HcclResult GetHeterogCollTag(HcomOperationType opType, std::string &tag);
};
}
#endif